package work.xiaohong.websocket.dao;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import work.xiaohong.websocket.vo.SendMsgVo;

import java.util.List;

/**
 * @author xiaohong
 * @version 1.0
 * @date 2021/9/26 0026 11:15
 * @description SendMsgVo mapper
 */
public interface SendMsgVoMapper extends MongoRepository<SendMsgVo,String > {

    Page<SendMsgVo> findBySender(String sender, Pageable pageable);

    Page<SendMsgVo> findByReceiver(String receiver, Pageable pageable);

    /**
     * 分页查找与某好友的聊天记录
     * @param sender
     * @param receiver
     * @param pageable
     * @return
     */
    Page<SendMsgVo> findSendMsgVoBySenderAndReceiver(String sender, String receiver, Pageable pageable);

    /**
     * 查找未读消息
     * @param receiver
     * @param status
     * @return
     */
    List<SendMsgVo> findAllByReceiverAndStatus(String receiver,Integer status);

}
